package com.example.kafka.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

    @RestController
    @RequestMapping("producer")
    public class ProducerController {

        @Autowired
        private KafkaTemplate<String, String> kafkaTemplate;

        @RequestMapping("msg")
        public String send(String msg){
            kafkaTemplate.send("myqueue", msg);
            return "success";
        }

    }


